/*!
 * Start Bootstrap - Agency Bootstrap Theme (http://startbootstrap.com)
 * Code licensed under the Apache License v2.0.
 * For details, see http://www.apache.org/licenses/LICENSE-2.0.
 */

// jQuery for page scrolling feature - requires jQuery Easing plugin
$(function() {
    $('a.page-scroll').bind('click', function(event) {
        var $anchor = $(this);
        var $x = $anchor.attr('href');
        $('html, body').stop().animate({
            scrollTop: $($anchor.attr('href')).offset().top
        }, 1500, 'easeInOutExpo');
        //alert($anchor.attr('id'))
        //if ( "NavbarBrand" != $anchor.attr('id') ) {
            $anchor.removeClass('flash').addClass('flash animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
            $anchor.removeClass('flash');
            });
		//}
		
		setTimeout( animateFInDown, 900 );
		function animateFInDown() {
			//alert($x)
            $($x + ' .FInDown').removeClass('fadeInDown').addClass('fadeInDown animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
            $(this).removeClass('fadeInDown');
            });
		}
			
		setTimeout( animateFInUp, 1000 );
		function animateFInUp() {
			//alert($x)
            $($x + ' .FInUp').removeClass('fadeInUp').addClass('fadeInUp animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
            $(this).removeClass('fadeInUp');
            });
		}

		setTimeout( animateFInLeft, 1000 );
		function animateFInLeft() {
			//alert($x)
            $($x + ' .FInLeft').removeClass('fadeInLeft').addClass('fadeInLeft animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
            $(this).removeClass('fadeInLeft');
            });
		}

		setTimeout( animateFInRight, 1000 );
		function animateFInRight() {
			//alert($x)
            $($x + ' .FInRight').removeClass('fadeInRight').addClass('fadeInRight animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
            $(this).removeClass('fadeInRight');
            });
		}

        event.preventDefault();

    });
	
	//scrollify
	//$('.scroll_page').css({'height': $(window).height()});
//	$.scrollify({
//		section: '.scroll_page'
//	});
	
});

// Highlight the top nav as scrolling occurs
$('body').scrollspy({
    target: '.navbar-fixed-top'
})

// Closes the Responsive Menu on Menu Item Click
$('.navbar-collapse ul li a').click(function() {
    $('.navbar-toggle:visible').click();
});